<!--header str-->
{template "common","header"}
<!--header end-->
<script type="text/javascript" src="{JS_PATH}formvalidator.js" charset="UTF-8"></script>
<script type="text/javascript" src="{JS_PATH}formvalidatorregex.js" charset="UTF-8"></script>
<script type="text/javascript" src="{JS_PATH}layer/layer.min.js"></script>
<script language="JavaScript">
<!--
$(function(){
	$.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});
	$("#username").formValidator({onshow:"请输入用户名",onfocus:"2-30位之间"}).inputValidator({min:2,max:30,onerror:"2-30位之间"}).regexValidator({regexp:"ps_username",datatype:"enum",onerror:"用户名格式不正确"});
	$("#password").formValidator({onshow:"请输入密码",onfocus:"6-20位之间"}).inputValidator({min:6,max:20,onerror:"6-20位之间"});
	$("#email")
	.formValidator({
        onshow : "请输入邮箱",
        onfocus : "邮箱6-50个字符",
        forcevalid : true
	})
});
//-->
</script>
<!--wrap_activity str-->
<div class="wrap" id="wrap">
	<div class="reg_main">
		<form action="/index.php?m=hchmember&c=index&a=register" id='frmreg' method="post">
		<table class="heiti">
			<tr>
				<td class="title">注册为会员</td>
			</tr>
			<tr>
				<td class="reg_header" valign="top" >用户名</td>
				<td width="220">
					<input type="text" name="item[username]" id="username"/>
				</td>
			</tr>
			<tr>
				<td class="reg_header">密码</td>
				<td>
					<input type="password" name="item[password]" id="password"/>
				</td>
			</tr>
			<tr>
				<td class="reg_header">再一次密码</td>
				<td>
					<input type="password" name="confirm_password" id="confirm_password"/>
				</td>
			</tr>
			<tr>
				<td class="reg_header">Email</td>
				<td>				
					<input type="text" name="item[email]" id="email"/>
				</td>
			</tr>
			<tr>
				<td align="center" colspan="2">
					&nbsp;
					<input type="hidden" name="m" value="hchmember">
					<input type="hidden" name="c" value="index">
					<input type="hidden" name="a" value="register">
					<input type="hidden" name="dosubmit" value="submit"/>
					<input type="checkbox" name="agree" id="agree" value="1">我同意
					<a href="#" class="sky" id="layer_service" >服务协议</a> 和
					<a href="#" class="sky" id="layer_app" >隐私保护申明</a>
				</td>
			</tr>
			<tr>
				<td align="center" colspan="2">
					<a href="javascript:void(0)" class="register_submit" style="cursor:pointer">注 &nbsp;&nbsp;册</a>
				</td>
			</tr>
			<tr>
				<td><!-- 用微博帐号登录 --></td>
				<td></td>
			</tr>
		</table>
		</form>
		
	</div>
	
</div>
<script type="text/javascript">
<!--
	$('.register_submit').click(function(){
        //检测用户名
		var usr = $("#username").val();
        var search_str = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
		if(!usr){
            alert('请输入用户名！');
            return false;
		}
        if(usr.length < 2 || usr.length > 30){
            alert('用户名长度不符！');
            return false;
        }
        //检测密码
        var pwd = $("#password").val();
        if(!pwd){
            alert('请设置密码！');
            return false;
        }
        if(pwd.length < 6 || pwd.length > 10){
            alert('密码长度不符！');
            return false;
        }
        //确认密码
        var conpwd = $("#confirm_password").val();
        if(pwd != conpwd){
            alert('两次密码输入不一致');
            return false;
        }
        //检测邮箱
        var email = $("#email").val();
        var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
        if(!reg.test(email)){
            alert('请输入正确的邮箱地址！');
            return false;
        }
        //同意条款
        if(!$('#agree').is(':checked')){
            alert('请仔细阅读服务协议，并勾选！');
            return false;
        }

        $("#frmreg").submit();
		
	})

    $('#layer_service').live('click',function(event){
        var height = $(window).height(), index = $.layer({
            type : 2,
            shade : [0.5 , '#000' , true],
            shadeClose : true,
            border : [!0],
            title : false,
            offset : ['25px',''],
            area : ['90%', (height - 50)+'px'],
            iframe : {src : "/?m=hchmember&c=index&a=regServiceText"}
        });
        event.preventDefault();
    });

	$('#layer_app').live('click',function(event){
	    var height = $(window).height(), index = $.layer({
	        type : 2,
	        shade : [0.5 , '#000' , true],
	        shadeClose : true,
	        border : [!0],
	        title : false,
	        offset : ['25px',''],
	        area : ['90%', (height - 50)+'px'],
	        iframe : {src : "/?m=hchmember&c=index&a=regAppText"}
	    });
	    event.preventDefault();
	});

//-->
</script>
<!--wrap end-->
<!--footer str-->
{template "common","footer"}
<!--footer end-->
</body>
</html>